#-*-coding:UTF-8-*-
#正则表达式
'''
Created on 2013-6-4

@author: hanjiewu
'''
import re
m = re.match("foo", "seafood")
if m is not None:
    print m.group()
m = re.search("foo", "seafood")
if m is not None:
    print m.group()
print re.sub("X", "Mr. Smith", "attn: X\n\nDear X,\n")
#re.split(pattern, string, maxsplit, flags)

ss = '-rw-r--r-- 1 ftp ftp            495 Jun 19  2012 2012-06-19-22-50-33-1500238000-preImport.csv'
regex= re.compile(r"ftp\s*([0-9]+)")
m = regex.search(ss)
if m is not None:
    print m.group(1)